package a.f.d;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.v;
import a.c.x;
import a.f.o;
import a.i.l;
import a.i.nb;

import java.util.Comparator;

public class jb
  implements u
{
  protected u f;
  protected x g;
  private bb h;
  private x i;
  private x j;
  public static boolean k;
  
  public jb(u paramu)
  {
    this.f = paramu;
  }
  
  public void a(o paramo, bb[] paramArrayOfbb, k paramk)
  {
    int m = f.o;
    if (m == 0)
    {
      if ((paramk instanceof x))
      {
        this.j = ((x)paramk);
        if (m != 0) {
          break label100;
        }
      }
    }
    else {
      if (f.n == 0) {
        break label46;
      }
    }
    throw new IllegalStateException("Expected NodeMap layerID!");
    label46:
    this.i = paramo.B();
    this.h = new bb();
    a(paramo, paramArrayOfbb, this.j);
    this.f.a(paramo, paramArrayOfbb, this.j);
    b(paramo, paramArrayOfbb, this.j);
    label100:
    if (m == 0)
    {
      if (this.j != paramk) {
        throw new IllegalStateException("Expected NodeMap layerID!");
      }
      paramo.a(this.i);
      this.i = null;
      this.h = null;
    }
    this.g = null;
  }
  
  public void a(x paramx)
  {
    this.g = paramx;
    this.f.a(paramx);
  }
  
  public void b(double paramDouble)
  {
    this.f.b(paramDouble);
  }
  
  public void d(double paramDouble)
  {
    this.f.d(paramDouble);
  }
  
  public void c(double paramDouble)
  {
    this.f.c(paramDouble);
  }
  
  public void a(double paramDouble)
  {
    this.f.a(paramDouble);
  }
  
  protected void a(o paramo, bb[] paramArrayOfbb, x paramx)
  {
    int i7 = f.o;
    int i6 = f.n;
    d[] arrayOfd = new d[paramo.l()];
    int[] arrayOfInt = new int[paramo.j()];
    int m = 0;
    do
    {
      if (m >= paramArrayOfbb.length) {
        break;
      }
      int n = 0;
      v localv1 = paramArrayOfbb[m].f();
      if (localv1 != null)
      {
        this.i.a(localv1.c(), localv1);
        arrayOfInt[((e)localv1.c()).f()] = n;
        localv1 = localv1.a();
        n++;
      }
      for (;;)
      {
        if (i7 == 0) {
          if (i6 == 0)
          {
            if (i6 == 0) {
              break;
            }
            if (i7 != 0) {
              continue;
            }
            m++;
          }
        }
      }
    } while (i6 == 0);
    Comparator local0 = new Comparator()
    {
      private final int[] val$nodePos;
      
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        return l.a(this.val$nodePos[((d)paramAnonymousObject1).e().f()], this.val$nodePos[((d)paramAnonymousObject2).e().f()]);
      }
    };
    Comparator local1 = new Comparator()
    {
      private final int[] val$nodePos;
      
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        return l.a(this.val$nodePos[((d)paramAnonymousObject1).f().f()], this.val$nodePos[((d)paramAnonymousObject2).f().f()]);
      }
    };
    int i1 = 0;
    label157:
    bb localbb;
    v localv2;
    e locale1;
    int i2;
    label288:
    label297:
    d locald3;
    v localv3;
    v localv4;
    int i5;
    label402:
    label414:
    label417:
    e locale2;
    label509:
    do
    {
      if (i1 >= paramArrayOfbb.length - 1) {
        break;
      }
      localbb = paramArrayOfbb[(i1 + 1)];
      if (i6 != 0) {
        break label554;
      }
      localv2 = paramArrayOfbb[i1].f();
      do
      {
        if (localv2 == null) {
          break label509;
        }
        locale1 = (e)localv2.c();
        if (i6 != 0) {
          break label157;
        }
        if (locale1.e() > 1)
        {
          if (i7 != 0) {
            continue;
          }
          if (locale1.e() % 2 == 0)
          {
            i2 = 0;
            d locald1 = locale1.h();
            do
            {
              if (locald1 == null) {
                break;
              }
              arrayOfd[i2] = locald1;
              locald1 = locald1.i();
              i2++;
              if (i7 != 0) {
                break label297;
              }
              if (i6 != 0) {
                break label288;
              }
            } while (i6 == 0);
            if (i7 != 0) {
              break label657;
            }
            l.a(arrayOfd, 0, i2, local1);
            int i3 = locale1.e() / 2 - 1;
            locald3 = arrayOfd[i3];
            localv3 = (v)this.i.get(arrayOfd[i3].f());
            localv4 = (v)this.i.get(arrayOfd[(i3 + 1)].f());
            if (localv3 != localv4)
            {
              i5 = 1;
              do
              {
                do
                {
                  if (localv3 == localv4) {
                    break label417;
                  }
                  if (i6 != 0) {
                    break;
                  }
                  if (i5 == 0) {
                    break label402;
                  }
                  i5 = 0;
                  localv3 = localv3.a();
                  if (i7 != 0) {
                    break label414;
                  }
                } while (i6 == 0);
                i5 = 1;
                localv4 = localv4.b();
              } while (i6 == 0);
              locale2 = paramo.i();
              this.h.add(nb.a(locale2, localbb));
              this.i.a(locale2, localbb.a(locale2, localv3));
              paramx.a(locale2, i1 + 1);
              paramo.a(locale1, locald3, locale2, null, 0, 0);
              if (i7 != 0) {
                break label868;
              }
              paramo.b(locale2, 0.0D, 0.0D);
            }
          }
        }
        localv2 = localv2.a();
      } while (i6 == 0);
      i1++;
    } while ((i7 == 0) && (i6 == 0));
    if (i7 == 0) {
      i1 = paramArrayOfbb.length - 1;
    }
    label536:
    label554:
    label868:
    label871:
    label880:
    label883:
    do
    {
      do
      {
        if (i1 < 1) {
          break;
        }
        localbb = paramArrayOfbb[(i1 - 1)];
        localv2 = paramArrayOfbb[i1].f();
        do
        {
          if (localv2 == null) {
            break label883;
          }
          do
          {
            locale1 = (e)localv2.c();
            if (i6 != 0) {
              break label536;
            }
            if (locale1.d() <= 1) {
              break label871;
            }
            if (i7 != 0) {
              break label880;
            }
            if (locale1.d() % 2 != 0) {
              break label871;
            }
            i2 = 0;
            d locald2 = locale1.i();
            if (locald2 != null) {}
            while (i7 != 0)
            {
              arrayOfd[i2] = locald2;
              locald2 = locald2.j();
              i2++;
              if (i7 != 0) {
                break label671;
              }
              if (i6 != 0) {
                break label662;
              }
              if (i6 == 0) {
                break;
              }
            }
            l.a(arrayOfd, 0, i2, local0);
            int i4 = locale1.d() / 2 - 1;
            locald3 = arrayOfd[i4];
            localv3 = (v)this.i.get(arrayOfd[i4].e());
            localv4 = (v)this.i.get(arrayOfd[(i4 + 1)].e());
            if (localv3 == localv4) {
              break label871;
            }
            i5 = 1;
            do
            {
              do
              {
                if (localv3 == localv4) {
                  break label791;
                }
                if (i6 != 0) {
                  break;
                }
                if (i5 == 0) {
                  break label776;
                }
                i5 = 0;
                localv3 = localv3.a();
                if (i7 != 0) {
                  break label788;
                }
              } while (i6 == 0);
              i5 = 1;
              localv4 = localv4.b();
            } while (i6 == 0);
            locale2 = paramo.i();
            this.h.add(nb.a(locale2, localbb));
            this.i.a(locale2, localbb.a(locale2, localv3));
            paramx.a(locale2, i1 - 1);
            paramo.a(locale2, null, locale1, locald3, 0, 0);
          } while (i7 != 0);
          paramo.b(locale2, 0.0D, 0.0D);
          localv2 = localv2.a();
        } while (i6 == 0);
        i1--;
      } while (i7 != 0);
    } while (i6 == 0);
    label657:
    label662:
    label671:
    return;
  }
  
  protected void b(o paramo, bb[] paramArrayOfbb, x paramx)
  {
    int m = f.n;
    v localv = this.h.f();
    do
    {
      if (localv == null) {
        break;
      }
      nb localnb = (nb)localv.c();
      e locale = (e)localnb.a;
      bb localbb = (bb)localnb.b;
      localbb.h((v)this.i.get(locale));
      paramo.a(locale);
      localv = localv.a();
    } while (m == 0);
  }
  
  public u a()
  {
    return this.f;
  }
  
  public void a(u paramu)
  {
    this.f = paramu;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.jb

 * JD-Core Version:    0.7.0.1

 */